from typing import List

class Solution:
    def minDeletionSize(self, strs: List[str]) -> int:
        colN = len(strs[0])
        colFlag = [False] * colN
        ans = 0
        for r  in range(1, len(strs)):
            prevRow = strs[r-1]
            currRow = strs[r] 
            for c in range(len(currRow)):
                if colFlag[c]:
                    continue
                cur, prev = ord(currRow[c]), ord(prevRow[c])
                if cur < prev:
                    colFlag[c] = True
                    ans += 1 
        return ans


    def minDeletionSize2(self, strs: List[str]) -> int:
        ans=0
        for i in zip(*strs):
            if list(i)!=sorted(i):
                ans += 1
        return ans